package org.hao.samples.model;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;

@Entity
@Table(name = "exam_subject")
public class Subject implements Serializable {
	private static final long serialVersionUID = -6530168542617015609L;

	@Id
	@GeneratedValue
	@Column(name = "sub_id", nullable = false)
	private Integer sub_id;

	@NotEmpty(message = "科目不能为空")
	@Length(max = 45, message = "字符最大不超过45")
	@Column(name = "name", length = 45, nullable = false)
	private String name;

	@Length(max = 255, message = "字符最大不超过255")
	@Column(name = "description", length = 255, nullable = false)
	private String description;

	@NotNull(message = "考试场数不能为空")
	@Max(value = 100, message = "考试场数最大不超过100")
	@Column(name = "test_count", length = 11, nullable = false)
	private Integer test_count;

	@NotNull(message = "考试时长不能为空")
	@Column(name = "total_time", length = 11, nullable = false)
	private Integer total_time;

	@NotNull(message = "考试分数不能为空")
	@Column(name = "total_score", length = 5, nullable = false)
	private Double total_score;

	@Column(name = "status", length = 1, nullable = false)
	private Integer status;

	@OneToMany(mappedBy = "subject")
	private Set<ExamUserSubject> examUserSubjects;

	@OneToMany(mappedBy = "subject")
	private Set<Exam_test> examTest;

	@OneToMany(mappedBy = "subject")
	private Set<ExamScore> score;

	public Subject() {
		super();
	}

	public Subject(String name, String description, Integer test_count, Integer total_time, Double total_score,
			Integer status) {
		super();
		this.name = name;
		this.description = description;
		this.test_count = test_count;
		this.total_time = total_time;
		this.total_score = total_score;
		this.status = status;
	}

	public Integer getSub_id() {
		return sub_id;
	}

	public void setSub_id(Integer sub_id) {
		this.sub_id = sub_id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public Integer getTest_count() {
		return test_count;
	}

	public void setTest_count(Integer test_count) {
		this.test_count = test_count;
	}

	public Integer getTotal_time() {
		return total_time;
	}

	public void setTotal_time(Integer total_time) {
		this.total_time = total_time;
	}

	public Double getTotal_score() {
		return total_score;
	}

	public void setTotal_score(Double total_score) {
		this.total_score = total_score;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Set<ExamUserSubject> getExamUserSubjects() {
		return examUserSubjects;
	}

	public void setExamUserSubjects(Set<ExamUserSubject> examUserSubjects) {
		this.examUserSubjects = examUserSubjects;
	}

	public Set<Exam_test> getExamTest() {
		return examTest;
	}

	public void setExamTest(Set<Exam_test> examTest) {
		this.examTest = examTest;
	}

	public Set<ExamScore> getScore() {
		return score;
	}

	public void setScore(Set<ExamScore> score) {
		this.score = score;
	}

}
